/*
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2023-11-24 15:38:32
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2023-11-24 16:06:39
 * @FilePath: \WingsUpdater-main\inc\Proc.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

#pragma once
#include "Platform.h"
#include <vector>
#include <string>

/**
 *@brief         set thread's name.
 *@tparam        none
 *@param         name thread name.
 *@param         tid thread id, default argument is current thread itself.
 *@return        true: set done; false: set failed.
 *@deprecated    none
 */
bool setThreadName(const std::string &name, const pthread_t tid = pthread_self());

/**
 *@brief         set process's priority.
 *@tparam        none
 *@param         prior process priority.
 *@param         type which type priority ? see "__priority_which"
 *@return        true: set done; false: set failed.
 *@deprecated    none
 */
bool setProcPriority(const int prior = 0,const enum __priority_which type = __priority_which::PRIO_PROCESS);

/**
 *@brief         get process's priority.
 *@tparam        none
 *@param         receiver getted value receiver.
 *@return        true: get done; false: get failed.
 *@deprecated    none
 */
bool getProcPriority(int *receiver);

/**
 *@brief         bind the process 'pid' to run on the cpuNo CPU core.
 *@tparam        none
 *@param         pid process id to be bind,zero indicates current process.
 *@param         cpuNo nth CPU core,zero indicates CPU core 0.
 *@return        true: bind done; false: bind failed.
 *@deprecated    none
 */
bool setCpuAffinity(const pid_t pid = 0,const uint32_t cpuNo = 0);

/**
 *@brief         bind the thread 'tid' to run on the cpuNo CPU core.
 *@tparam        none
 *@param         tid thread id to be bind.
 *@param         cpuNo nth CPU core,zero indicates CPU core 0.
 *@return        true: bind done; false: bind failed.
 *@deprecated    none
 */
bool setCpuAffinity(const pthread_t tid,const uint32_t cpuNo = 0);

/**
 *@brief         query CPU affinity,to know application processses or threads can run on whose CPU core.
 *@tparam        none
 *@param         isProcess true: query process;false: query thread.
 *@return        CPU core number vector,it indicates no any CPU core is compatible with current process or thread who called this function if it is empty,
 *               otherwise,you will get a vector contains those CPU core number.
 *@deprecated    none
 */
std::vector<unsigned int> getCpuAffinity(const bool isProcess = true);
